//
//	ZcoModelSessionInfo.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelSessionInfo.h"

NSString *const kZcoModelSessionInfoClientId = @"clientId";
NSString *const kZcoModelSessionInfoMembers = @"members";
NSString *const kZcoModelSessionInfoRefershTicketTime = @"refersh_ticket_time";
NSString *const kZcoModelSessionInfoRoomId = @"roomId";
NSString *const kZcoModelSessionInfoRoomToken = @"roomToken";
NSString *const kZcoModelSessionInfoSessionId = @"sessionId";
NSString *const kZcoModelSessionInfoTicket = @"ticket";

@interface ZcoModelSessionInfo ()
@end
@implementation ZcoModelSessionInfo




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelSessionInfoClientId] isKindOfClass:[NSNull class]]){
		self.clientId = dictionary[kZcoModelSessionInfoClientId];
	}	
	if(dictionary[kZcoModelSessionInfoMembers] != nil && [dictionary[kZcoModelSessionInfoMembers] isKindOfClass:[NSArray class]]){
		NSArray * membersDictionaries = dictionary[kZcoModelSessionInfoMembers];
		NSMutableArray * membersItems = [NSMutableArray array];
		for(NSDictionary * membersDictionary in membersDictionaries){
			ZcoModelMember * membersItem = [[ZcoModelMember alloc] initWithDictionary:membersDictionary];
			[membersItems addObject:membersItem];
		}
		self.members = membersItems;
	}
	if(![dictionary[kZcoModelSessionInfoRefershTicketTime] isKindOfClass:[NSNull class]]){
		self.refershTicketTime = [dictionary[kZcoModelSessionInfoRefershTicketTime] integerValue];
	}

	if(![dictionary[kZcoModelSessionInfoRoomId] isKindOfClass:[NSNull class]]){
		self.roomId = dictionary[kZcoModelSessionInfoRoomId];
	}	
	if(![dictionary[kZcoModelSessionInfoRoomToken] isKindOfClass:[NSNull class]]){
		self.roomToken = dictionary[kZcoModelSessionInfoRoomToken];
	}	
	if(![dictionary[kZcoModelSessionInfoSessionId] isKindOfClass:[NSNull class]]){
		self.sessionId = dictionary[kZcoModelSessionInfoSessionId];
	}	
	if(![dictionary[kZcoModelSessionInfoTicket] isKindOfClass:[NSNull class]]){
		self.ticket = dictionary[kZcoModelSessionInfoTicket];
	}	
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.clientId != nil){
		dictionary[kZcoModelSessionInfoClientId] = self.clientId;
	}
	if(self.members != nil){
		NSMutableArray * dictionaryElements = [NSMutableArray array];
		for(ZcoModelMember * membersElement in self.members){
			[dictionaryElements addObject:[membersElement toDictionary]];
		}
		dictionary[kZcoModelSessionInfoMembers] = dictionaryElements;
	}
	dictionary[kZcoModelSessionInfoRefershTicketTime] = @(self.refershTicketTime);
	if(self.roomId != nil){
		dictionary[kZcoModelSessionInfoRoomId] = self.roomId;
	}
	if(self.roomToken != nil){
		dictionary[kZcoModelSessionInfoRoomToken] = self.roomToken;
	}
	if(self.sessionId != nil){
		dictionary[kZcoModelSessionInfoSessionId] = self.sessionId;
	}
	if(self.ticket != nil){
		dictionary[kZcoModelSessionInfoTicket] = self.ticket;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.clientId != nil){
		[aCoder encodeObject:self.clientId forKey:kZcoModelSessionInfoClientId];
	}
	if(self.members != nil){
		[aCoder encodeObject:self.members forKey:kZcoModelSessionInfoMembers];
	}
	[aCoder encodeObject:@(self.refershTicketTime) forKey:kZcoModelSessionInfoRefershTicketTime];	if(self.roomId != nil){
		[aCoder encodeObject:self.roomId forKey:kZcoModelSessionInfoRoomId];
	}
	if(self.roomToken != nil){
		[aCoder encodeObject:self.roomToken forKey:kZcoModelSessionInfoRoomToken];
	}
	if(self.sessionId != nil){
		[aCoder encodeObject:self.sessionId forKey:kZcoModelSessionInfoSessionId];
	}
	if(self.ticket != nil){
		[aCoder encodeObject:self.ticket forKey:kZcoModelSessionInfoTicket];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.clientId = [aDecoder decodeObjectForKey:kZcoModelSessionInfoClientId];
	self.members = [aDecoder decodeObjectForKey:kZcoModelSessionInfoMembers];
	self.refershTicketTime = [[aDecoder decodeObjectForKey:kZcoModelSessionInfoRefershTicketTime] integerValue];
	self.roomId = [aDecoder decodeObjectForKey:kZcoModelSessionInfoRoomId];
	self.roomToken = [aDecoder decodeObjectForKey:kZcoModelSessionInfoRoomToken];
	self.sessionId = [aDecoder decodeObjectForKey:kZcoModelSessionInfoSessionId];
	self.ticket = [aDecoder decodeObjectForKey:kZcoModelSessionInfoTicket];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelSessionInfo *copy = [ZcoModelSessionInfo new];

	copy.clientId = [self.clientId copy];
	copy.members = [self.members copy];
	copy.refershTicketTime = self.refershTicketTime;
	copy.roomId = [self.roomId copy];
	copy.roomToken = [self.roomToken copy];
	copy.sessionId = [self.sessionId copy];
	copy.ticket = [self.ticket copy];

	return copy;
}
@end
